﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp5
{
    class Program
    {
        enum Caiquan
        {
            剪刀 = 1,
            石头 = 2,
            布 = 3
        }

        static void Main(string[] args)
        {

            Random ran = new Random();
            Console.WriteLine("--------------- 欢 迎 进 入 游 戏 世 界 ---------------");
            Console.WriteLine("*********************");
            Console.WriteLine("******猜拳，开始*****");
            Console.WriteLine("*********************");
            Console.WriteLine("出拳规则：1.剪刀 2.石头 3.布");
            Console.WriteLine("请选择对方角色<1：刘备 2：孙权 3：曹操>");
            int num = int.Parse(Console.ReadLine()); 
            switch (num)
            {
                case 1:
                    Console.WriteLine("你选择了刘备");
                    Console.WriteLine("请输入您的姓名：");
                    string name = Console.ReadLine();
                    Console.WriteLine(name+" VS 刘备 对战");
                    Console.WriteLine("开始游戏吗？<yes/no>");
                    string a = Console.ReadLine();


                    if (a == "yes")
                    {
                        Console.WriteLine("请出拳：1.剪刀 2.石头 3.布 （输入相应数字：）");
                        int num2 = int.Parse(Console.ReadLine());
                        
                        switch (num2)
                        {
                            case 1:
                                int player = 1;
                                
                                Console.WriteLine(name+":出拳：剪刀");
                                    int b = ran.Next(0, 4);
                                string strPC = "";
                                if (b == 1)
                                {
                                    strPC = "剪刀";
                                }
                                else if (b == 2)
                                {
                                    strPC = "石头";
                                }
                                else if (b == 3)
                                {
                                    strPC = "布";
                                }
                                Console.WriteLine("刘备 ：出拳："+strPC);
                                int pc = b;
                                if (player - pc == -2)
                                {
                                    Console.WriteLine("恭喜，" + name + "赢了");
                                }
                                else if (player - pc == -1)
                                {
                                    Console.WriteLine("八嘎，" + name + "输了");
                                }
                                else {
                                    Console.WriteLine("出错");
                                }
                                Console.WriteLine("是否开始下一轮？<yes/no>");
                                break;
                            case 2:
                                int player2 = 2;

                                Console.WriteLine(name + ":出拳：石头");
                                int c = ran.Next(0, 4);
                                string strPC2 = "";
                                if (c == 1)
                                {
                                    strPC = "剪刀";
                                }
                                else if (c == 2)
                                {
                                    strPC = "石头";
                                }
                                else if (c == 3)
                                {
                                    strPC = "布";
                                }
                                Console.WriteLine("刘备 ：出拳：" + strPC2);
                                int pc2 = c;
                                if (player2 - pc2 == 1)
                                {
                                    Console.WriteLine("恭喜，" + name + "赢了");
                                }
                                else if (player2 - pc2 == -1)
                                {
                                    Console.WriteLine("八嘎，" + name + "输了");
                                }
                                else
                                {
                                    Console.WriteLine("出错");
                                }
                                Console.WriteLine("是否开始下一轮？<yes/no>");
                                break;
                            case 3:
                                int player3 = 3;

                                Console.WriteLine(name + ":出拳：布");
                                int d = ran.Next(0, 4);
                                string strPC3 = "";
                                if (d == 1)
                                {
                                    strPC = "剪刀";
                                }
                                else if (d== 2)
                                {
                                    strPC = "石头";
                                }
                                else if (d == 3)
                                {
                                    strPC = "布";
                                }
                                Console.WriteLine("刘备 ：出拳：" + strPC3);
                                int pc3 = d;
                                if (player3 - pc3 == 1)
                                {
                                    Console.WriteLine("恭喜，" + name + "赢了");
                                }
                                else if (player3 - pc3 == 2)
                                {
                                    Console.WriteLine("八嘎，" + name + "输了");
                                }
                                else
                                {
                                    Console.WriteLine("出错");
                                }
                                Console.WriteLine("是否开始下一轮？<yes/no>");
                                break;
                            default:
                                break;
                        }
                    } else if (a=="no")
                    {
                        Console.WriteLine("系统退出");
                        break;
                    }
                    break;
                case 2:
                    Console.WriteLine("你选择了孙权");
                    Console.WriteLine("请输入您的姓名：");
                    string name2 = Console.ReadLine();
                    Console.WriteLine(name2 + " VS 孙权 对战");
                    Console.WriteLine("开始游戏吗？<yes/no>");
                    string e = Console.ReadLine();


                    if (e == "yes")
                    {
                        Console.WriteLine("请出拳：1.剪刀 2.石头 3.布 （输入相应数字：）");
                        int num2 = int.Parse(Console.ReadLine());

                        switch (num2)
                        {
                            case 1:
                                int player = 1;

                                Console.WriteLine(name2 + ":出拳：剪刀");
                                int b = ran.Next(0, 4);
                                string strPC = "";
                                if (b == 1)
                                {
                                    strPC = "剪刀";
                                }
                                else if (b == 2)
                                {
                                    strPC = "石头";
                                }
                                else if (b == 3)
                                {
                                    strPC = "布";
                                }
                                Console.WriteLine("孙权 ：出拳：" + strPC);
                                int pc = b;
                                if (player - pc == -2)
                                {
                                    Console.WriteLine("恭喜，" + name2 + "赢了");
                                }
                                else if (player - pc == -1)
                                {
                                    Console.WriteLine("八嘎，" + name2 + "输了");
                                }
                                else
                                {
                                    Console.WriteLine("出错");
                                }
                                Console.WriteLine("是否开始下一轮？<yes/no>");
                                break;
                            case 2:
                                int player2 = 2;

                                Console.WriteLine(name2 + ":出拳：石头");
                                int c = ran.Next(0, 4);
                                string strPC2 = "";
                                if (c == 1)
                                {
                                    strPC = "剪刀";
                                }
                                else if (c == 2)
                                {
                                    strPC = "石头";
                                }
                                else if (c == 3)
                                {
                                    strPC = "布";
                                }
                                Console.WriteLine("孙权 ：出拳：" + strPC2);
                                int pc2 = c;
                                if (player2 - pc2 == 1)
                                {
                                    Console.WriteLine("恭喜，" + name2 + "赢了");
                                }
                                else if (player2 - pc2 == -1)
                                {
                                    Console.WriteLine("八嘎，" + name2 + "输了");
                                }
                                else
                                {
                                    Console.WriteLine("出错");
                                }
                                Console.WriteLine("是否开始下一轮？<yes/no>");
                                break;
                            case 3:
                                int player3 = 3;

                                Console.WriteLine(name2 + ":出拳：布");
                                int d = ran.Next(0, 4);
                                string strPC3 = "";
                                if (d == 1)
                                {
                                    strPC = "剪刀";
                                }
                                else if (d == 2)
                                {
                                    strPC = "石头";
                                }
                                else if (d == 3)
                                {
                                    strPC = "布";
                                }
                                Console.WriteLine("孙权 ：出拳：" + strPC3);
                                int pc3 = d;
                                if (player3 - pc3 == 1)
                                {
                                    Console.WriteLine("恭喜，" + name2 + "赢了");
                                }
                                else if (player3 - pc3 == 2)
                                {
                                    Console.WriteLine("八嘎，" + name2 + "输了");
                                }
                                else
                                {
                                    Console.WriteLine("出错");
                                }
                                Console.WriteLine("是否开始下一轮？<yes/no>");
                                break;
                            default:
                                break;
                        }
                    }
                    else if (e == "no")
                    {
                        Console.WriteLine("系统退出");
                        break;
                    }
                    break;
                case 3:
                    Console.WriteLine("你选择了曹操");
                    Console.WriteLine("请输入您的姓名：");
                    string name3 = Console.ReadLine();
                    Console.WriteLine(name3 + " VS 曹操 对战");
                    Console.WriteLine("开始游戏吗？<yes/no>");
                    string r = Console.ReadLine();


                    if (r == "yes")
                    {
                        Console.WriteLine("请出拳：1.剪刀 2.石头 3.布 （输入相应数字：）");
                        int num2 = int.Parse(Console.ReadLine());

                        switch (num2)
                        {
                            case 1:
                                int player = 1;

                                Console.WriteLine(name3 + ":出拳：剪刀");
                                int b = ran.Next(0, 4);
                                string strPC = "";
                                if (b == 1)
                                {
                                    strPC = "剪刀";
                                }
                                else if (b == 2)
                                {
                                    strPC = "石头";
                                }
                                else if (b == 3)
                                {
                                    strPC = "布";
                                }
                                Console.WriteLine("曹操 ：出拳：" + strPC);
                                int pc = b;
                                if (player - pc == -2)
                                {
                                    Console.WriteLine("恭喜，" + name3+ "赢了");
                                }
                                else if (player - pc == -1)
                                {
                                    Console.WriteLine("八嘎，" + name3+ "输了");
                                }
                                else
                                {
                                    Console.WriteLine("出错");
                                }
                                Console.WriteLine("是否开始下一轮？<yes/no>");
                                break;
                            case 2:
                                int player2 = 2;

                                Console.WriteLine(name3 + ":出拳：石头");
                                int c = ran.Next(0, 4);
                                string strPC2 = "";
                                if (c == 1)
                                {
                                    strPC = "剪刀";
                                }
                                else if (c == 2)
                                {
                                    strPC = "石头";
                                }
                                else if (c == 3)
                                {
                                    strPC = "布";
                                }
                                Console.WriteLine("曹操：出拳：" + strPC2);
                                int pc2 = c;
                                if (player2 - pc2 == 1)
                                {
                                    Console.WriteLine("恭喜，" + name3 + "赢了");
                                }
                                else if (player2 - pc2 == -1)
                                {
                                    Console.WriteLine("八嘎，" + name3 + "输了");
                                }
                                else
                                {
                                    Console.WriteLine("出错");
                                }
                                Console.WriteLine("是否开始下一轮？<yes/no>");
                                break;
                            case 3:
                                int player3 = 3;

                                Console.WriteLine(name3 + ":出拳：布");
                                int d = ran.Next(0, 4);
                                string strPC3 = "";
                                if (d == 1)
                                {
                                    strPC = "剪刀";
                                }
                                else if (d == 2)
                                {
                                    strPC = "石头";
                                }
                                else if (d == 3)
                                {
                                    strPC = "布";
                                }
                                Console.WriteLine("曹操 ：出拳：" + strPC3);
                                int pc3 = d;
                                if (player3 - pc3 == 1)
                                {
                                    Console.WriteLine("恭喜，" + name3 + "赢了");
                                }
                                else if (player3 - pc3 == 2)
                                {
                                    Console.WriteLine("八嘎，" + name3+ "输了");
                                }
                                else
                                {
                                    Console.WriteLine("出错");
                                }
                                Console.WriteLine("是否开始下一轮？<yes/no>");
                                break;
                            default:
                                break;
                        }
                    }
                    else if (r == "no")
                    {
                        Console.WriteLine("系统退出");
                        break;
                    }
                    break;
                    break;
                    break;
                default:
                    break;
            }
        }
        
    }
}
